.code32
#include "screen.h"

intstr:
	.asciz "Interrupt occered.\n"
	.global isr
isr:
	pusha
	pushl $intstr
	call puts
	addl $4, %esp
	popa
	iret
	
.global isr0			/* i8253 PIT*/
isr0:
	pusha
	call pit_handler
	popa
	iret
	
.global isr1
isr1:				/*keyboard */
	pusha
	call keybd_handler
	popa
	iret
	
gp_msg:
	.asciz "#GP General Protection caught, sleep forever...\nError code:"
	.global gp
gp:
	xchgl %eax,(%esp)
	pusha
	pushl $gp_msg
	call puts
	xchgl %eax,(%esp)
	call disp_hex
	addl $4,%esp
	pushl $'\n'
	call putc
	addl $4,%esp
	popa
	popl %eax
	jmp .
	iret

	.global isr6
isr6:
	push $-1
	push $6
	pusha
	push %fs
	push %gs
	push %es
	push %ds
	push %esp
	call handler_dispatcher
	addl $4, %esp
	pop %ds
	pop %es
	pop %gs
	pop %fs
	popa
	addl $8, %esp
	iret
